﻿Imports System.IO

Public Class log
    Private swi As StreamWriter
    Private strFolderPath As String
    Private Const FileName As String = "solr.log"

    Public Sub New(ByVal strFolder As String)
        strFolderPath = strFolder
        File.Delete(strFolder & "/" & FileName)
        utils.FileCreate(strFolder & "/" & FileName)
        swi = File.AppendText(strFolder & "/" & FileName)
        swi.WriteLine("Log for the process, it will contain the last solr query for the files")
    End Sub

    Public Sub Append(ByVal strData As String)
        swi.WriteLine(strData)
        swi.Flush()
    End Sub

    Public Sub Close()
        swi.Flush()
        swi.Close()
        File.Delete(strFolderPath & "/" & FileName)
    End Sub
End Class
